#!/bin/bash

Dir="$1"
toDir="Resigned"
RDir="${Dir}/${toDir}"
if [ -d $RDir ]; then
    rm -rf $RDir
fi

find -d "$Dir" -name "*.ipa" > files.txt

while IFS='' read -r line || [[ -n "$line" ]]; do
   sh iWannaResignIPA "$line" "${toDir}"
#    rm -rf "$line"
# echo $line
done < files.txt

rm -rf files.txt

echo "all done!"
